Is there a better way or a more efficient way to write the attached stored proc that leans on to following best practice solution for writing a stored proc. For e.g can I add a try/catch block in this existing code or should I instead of declaring table variable should use temp tables etc. Any input would be highly appreciated.
Yes there are better ways of doing this.
😎
Looking through the code, everything there can be optimized with this one exception
ALTER PROCEDURE [dbo].[prEdPlanbyState]
Wow...really I never thought about it. Okay so actions speak louder than words so could you please optimize everything except for the "Alter Proc".