Abstract plans for stored procedures

For abstract plans to be captured for the SQL statements that can be optimized in stored procedures:

This sequence of steps captures the query text and abstract plans for all statements in the procedure that can be optimized:

set plan dump dev_plans on
go
create procedure myproc as ...
go
exec myproc
go

If the procedure is in cache, so that the plans for the procedure are not being captured, you can execute the procedure with recompile. Similarly, once a stored procedure has been executed using an abstract query plan, the plan in the procedure cache is used so that query plan association does not take place unless the procedure is read from disk.