• Be wary if you have any scalar functions in the procedure. I've seen it give misleading times on occasion. A way of determining the run time for the whole batch is to do exactly what you have above when you read GETDATE() into a datetime variable. Then, when you're done, use the following to get the total ms elapsed between the two times for the whole run.

    select datediff(ms, @starttime, @endtime);