Reset SQL Server execution plan

Brandon picture Brandon · Nov 3, 2009 · Viewed 36.3k times · Source

I've looked all over for this command....what's the command to reset the SQL Server's execution plan?

Answer

John Sansom picture John Sansom · Nov 3, 2009

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