OK I keep getting this error after about 3-4 minutes of churning:
Timeout expired. The timeout period elapsed prior to completion of the operation or the s
This is an example of an extremely bad re-use of code. Instead of reusing the stored proc which makes you loop through all input variables you want, write a new set-based proc that selects the information based on joins. It will be much faster (assuming you have properly indexed of course). In accessing databases, you do not want to do something through a loop or a cursor if a set-based alternative is possible.