Parameter Sniffing 1. replace parameters with local variables 2. WITH RECOMPILE SET STATISTICS IO ON SET STATISTICS IO OFF ---------------------- ORDER BY case when (@Condition1 = 1) then Column1 end, case when (@Condition1 = 2) then Column2 end desc ----------------------