Usually you do not want to do things in a looping manner in SQL Server. The db engine is optimized to do things with sets of data.
If you don't know how to move the code, or rewrite it, we can help with small snippets. However it's unlikely that many of us want to tune hundreds of lines of code for free. If you have a lot of code, and it is impacting your company, then I would suggest you talk with your boss and hire someone with more experience for a short term to both fix things and teach you more about SQL Server so you can better maintain the system. That is likely a better investment than a training class.
If you need to do this on an ongoing basis, I'd suggest you start reading more about SQL Server, and pick up the Inside SQL Server series and read it through to learn more.
Follow me on Twitter: @way0utwestForum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com