Reset SQL Server execution plan Reset SQL Server execution plan sql-server sql-server

Reset SQL Server execution plan


For clarity..........

Executing sp_recompile will "mark" the given stored procedure for recompilation, which will occur the next time it is executed.

Using the WITH RECOMPILE option will result in a new execution plan being generated each time the given stored procedure is executed.

To clear the entire procedure cache execute

DBCC FREEPROCCACHE


For stored procedures, you use the WITH RECOMPILE option.


If you want to reset QEP for a stored procedure, you shall use sp_recompile