This script will use the standard sp_who2 to fill a temporary table with currently run processes rather than copying the code from that sp_who2 to my own.
The difference from others are that it is also getting the command being run by the process. Normally I know what database is using the resources but not the actual query being run.
Parameters to use are:
@SPID - process to show
@DBName - processes for this db only
@running - 1 for currently running processes, 0 for not running processes and null for all
@blocked - 1 for blocked processes, 0 for non-blocked processes and null for all
@eventinfo - like search on the SQL command being run
Feel free to use it...