Just stumbled upon this situation myself, where I ran an invalid comment via xp_cmdshell.
I managed to kill it without restarting SQL, I did this to determine the process that runs the command and kill it from the task manager.
Suppose your SQL worked up in Windows 2008: In the "Task Manager" section of the "Processes" tab. I have included a column to display the command line for each process (for example: View → Select Columns ..).
If you do not know which command you ran through xp_cmdshell, dbcc inputbuffer ( SPID ) should give you the key.
source share