Get currently running SQL statement without VIEW SERVER STATE permission (SQL Server)
Googling this first suggests that you find the current user using sp_who and then checking the results of:
SELECT * FROM sys.dm_exec_requests CROSS APPLY sys.dm_exec_sql_text(sql_handle)
If you do not hold the SQL server VIEW SERVER STATE permission, it will deny this query.
However, you can use this query to get the currently running SQL statement even without that permission!
dbcc inputbuffer(@@SPID) WITH NO_INFOMSGS
This will return a result set that contains a column with the currently running query!
The WITH NO_INFOMSGS part is optional but will stop the statement from printing.