Hello,
Thank you for contacting the Google Cloud Community.
Using the @@SPID and sp_who System Functions:
- Retrieve the current SP ID: Use the @@SPID system function to obtain the unique identifier of the currently executing stored procedure.
- Query sp_who: Execute the sp_who system procedure with the @@SPID as a parameter to retrieve detailed information about the running stored procedure, including its name.
- Store the name: Store the retrieved SP name in the audit table.
Regards,
Jai Ade