tl;dr; Add PRINT and/or SELECT statements. Comment/uncomment out pieces of code to isolate problems. Change INSERT/UPDATE/DELETE statements to SELECTs. Disclaimer: These are techniques I use all the time. There are almost certainly others. Use what you find works best for you. Debugging stored procedures, functions, even views is something I end up doing quite a…