The only thing I can think of is if you create a table to hold a counter. At the start of the procedure, check there aren't too many. If there aren't, add one onto the counter and proceed. At the end of the procedure remove one from the counter.
It's not nice, and I'm sure you will run into problems with it, but it would solve your problem.