I am getting sqlcommand timeout issues when I debug the application even though the stored procedure runs in less than 25 seconds in management studio. I set the timeout attribute to 180 seconds and still get the error. Any suggestions?
Where did you set the timeout attribute at? I used to run into the same issue when I was setting the timeout in the SqlConnection string, but it turns out I also needed it in the SqlCommand itself.
25 seconds is a long time for a stored proc to be running. I'd suggest optimizing the query further.
Are you setting "Connect Timeout" or "Command Timeout" in connection string? It's easy to do mistakes with them.
--EDIT
Try searching in your code if your system isn't locking a table used in the SP.
It won't solve the problem, but logging the start/end of the procedure (on database side, by putting the SP inside another SP) can tell you if the problem is before starting the SP (because of network, webserver load, etc) or while executing it.
I hope it helps
Try running a sp_recompile against that stored procedure, then try from your application again.