Sometimes when you are running a long running script or stored procedure it’s nice to know whereabouts it has got to, often we put in
Instead of using
raiserror ('This is my message, show it now!', 0, 1) with nowait
This will have the same effect as if you had said:
print 'This is my message, show it now!'
Except it will send it to the client immediately.
Also note that
sys.dm_exec_requests may also be used to find out exactly what statement is being executed at any particular instant and from within which stored procedure, UDF, etc.