• In SQL 2000, use the function ::fn_get_sql (X'sqh handle') where SQL_handle is the sql_handle column from sysprocesses.

    In SQL 2005, have a look at sys.dm_exec_sql_text(sql_handle), getting sql_handle from sys.sysprocesses

    HTH