A Microsoft platform for building enterprise-level data integration and data transformations solutions.
I would suggest that you do this with a few of the procedures:
- Rename the existing procedure.
- Write a new procedure reusing the old name. All this procedure does is to: a) Log to audit table. b) Call the old procedure. c) Write to audit table.
If you see lag between the wrapper and the inner procedure, this is a strong indication that compilation is the culprit. But as I said, I find it unlikely that compilation takes three minutes.
Also, autostats will not wipe out the cache. It can trigger recompilation, but this occurs on statement level, so it is not the entire procedure that is recompiled. So if plans are being wiped out of the cache entirely, it is for some other reason.