Search code examples
sql-serversql-server-2008t-sqlstored-procedures

Current executing procedure name


Is it possible to get the name of the current Stored Procedure in MS SQL Server?

Maybe there is a system variable or function like GETDATE()?


Solution

  • You may try this:

    SELECT OBJECT_NAME(@@PROCID)
    

    Update: This command is still valid on SQL Server 2022.