you need to use the T-SQL debugger, please go through this article from MS on how to use it:

http://technet.microsoft.com/en-us/library/cc646008.aspx