Cool little trick to determine which sql query which is taking a long time to execute, first while offending query is running from another machine do
EXEC sp_who2
Locate the SPID responsible via Login, DBName and ProgramName columns, then do
DBCC INPUTBUFFER (<SPID>)
The offending query will be in the EventInfo column. This is a great little time saver for me, before I found out about this I used to split my concatenated query script in to multiple sql files until I located the problem query