I using next queries for extracting top 100 and 101 lines from DB and gettings following elapsing times, which completely different (second query ~8 slower than first):
SELECT TOP (100) *
FROM PhotoLike WHERE photoAccountId=@accountId AND accountId<>@accountId
ORDER BY createDate DESC
GO
SQL Server Execution Times: CPU time = 187 ms, elapsed time = 202 ms.
SELECT TOP (101) *
FROM PhotoLike WHERE photoAccountId=@accountId AND accountId<>@accountId
ORDER BY createDate DESC
GO
SQL Server Execution Times: CPU time = 266 ms, elapsed time = 1644 ms.
Execution plan of first two cases:

But if I get rid of @accoundId variable, I get following results, which approximately equals and faster more than 2 times than first query from this question.
SELECT TOP (100) *
FROM PhotoLike WHERE photoAccountId=10 AND accountId<>10
ORDER BY createDate DESC
GO
SQL Server Execution Times: CPU time = 358 ms, elapsed time = 90 ms.
SELECT TOP (101) *
FROM PhotoLike WHERE photoAccountId=10 AND accountId<>10
ORDER BY createDate DESC
GO
SQL Server Execution Times: CPU time = 452 ms, elapsed time = 93 ms.
Execution plan of second two cases:

Why is this happen and how can I improve performance with varibales?
UPDATE
Added execution plans.
TOP 100/TOP 101is known problem, see this blog. Speed degradation with parameters is probably due to parameter sniffing.OPTION (RECOMPILE)so it just makes a generic guess not based on the actual values at all. TheTOP 101behaviour isn't always a problem though looks like it is in this case. It is the cut off point between doing a full sort and aTOP Nsort.TOP 100i never liked solution given in this blog, and after browsing through your link I know why :-)