Perhaps if you substitute the stored procedure it runs many times while evaluating the query, but if you put the values into variables, it only runs once? Just a...
We had this problem in our enterprise also - it turned out that a majority of the databases had AUTO-CLOSE set to ON. This causes Enterprise Manager to open...