I have a stored procedure that dynamically builds a query and is then executed by the stored procedure sp_executesql. I did this so i could have the benefit of sql server re-using execution plans where possible. In the books online it states sp_executesql can be used instead of stored procedures to execute aTransact-SQL statement a number of times when the change in parametervalues to the statement is the only variation. Because the Transact-SQL statement itself remains constant and only the parameter values change, the Microsoft® SQL Server™ query optimizer is likely toreuse the execution plan it generates for the first execution
Which sounds great. but then if you read down further it says in sortof a batteries not included kind of wayNote If object names in the statement string are not fully qualified,the execution plan is not reused.
Ive fully qualified all the fields in my statement ( i think ).. and I now would like to test if its reusing the execution plan.. Is that possible?