Without an execution plan to understand what's happening and where you are experiencing slow performance, it's hard to say for sure. But, first off, I'd suggest using the UPDATE process rather than deleting then inserting the same record again. That may reduce the amount of processing you do since some updates are done in place (some are effectively a delete and insert, but it's worth shooting for the in place updates). Other than that, it's down to your indexes and your statistics. While I didn't look at every single line, the patterns I saw didn't indicate a fundamental issue in your approach (no functions on columns in WHERE clause or JOIN, etc.).