• Try this way, comment the create procedure line using declare give values to the parameters and run it as query and now you can check the place where you made changes and execute the temp tables and the logic query on the same query tab in such way you can know which query is taking more time and why.

    The other way is use SQL profiler.