Skip to content

Instantly share code, notes, and snippets.

@cbmeeks
Created May 10, 2018 18:40
Show Gist options
  • Save cbmeeks/3f3717685564b8b32a3b7a6686cce587 to your computer and use it in GitHub Desktop.
Save cbmeeks/3f3717685564b8b32a3b7a6686cce587 to your computer and use it in GitHub Desktop.
List stored procedures and when they were last run
SELECT
sc.name, p.name, st.last_execution_time
FROM sys.procedures AS p
INNER JOIN sys.schemas AS sc ON p.[schema_id] = sc.[schema_id]
LEFT OUTER JOIN sys.dm_exec_procedure_stats AS st ON p.[object_id] = st.[object_id]
ORDER BY
p.name, st.last_execution_time DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment