How to find Last Execution Date of Stored Procedure
I have seens this common question on few SQL Server Forum that how can i get the last execution date for Stored Procedur or when was the stored procedure exedcuted last.
Now How to achive this?
Every SQL Stament sent to SQL Server is PARSED,COMPILEd and EXECTED.SQL Server maintains QUERY PLAN for each and every statement and keeps it in the system tables.
Which we can query using DMV’s.Query Plans are flushed out if SQL Server Service gets started manulally or automatically(In cluster mode)/runs update stats command / reindexing / usinf DBCC CACHE Clean Commands.
To get last execution date of the stored procedure if SQL Server has the Query Plan for it.