How to check date of last change in stored procedure or function in SQL server

Marek Kwiendacz picture Marek Kwiendacz · Apr 7, 2011 · Viewed 454.9k times · Source

I need to check when function was changed last time. I know how to check creation date (it is in function properties window in SQL Server Management Studio).
I found that in SQL Server 2000 it wasn't possible to check modify date ( look at this post: Is it possible to determine when a stored procedure was last modified in SQL Server 2000?)

Is it possible to check it in SQL Server 2008? Does MS add some new feature in system tables that allow to check it?

Answer

Chris Diver picture Chris Diver · Apr 7, 2011
SELECT name, create_date, modify_date 
FROM sys.objects
WHERE type = 'P'
ORDER BY modify_date DESC

The type for a function is FN rather than P for procedure. Or you can filter on the name column.