>May be we need to add some wait in between each command. The else case looks OK to me except that I would not risk using - Temporary and rather use _Temporary as prefix. - requires using of [] and I'm not 100% sure about your last sp_rename command. So, just to be 100% safe I'd change - to _
This is what I thought about half an hour ago. After the UPDATE, it seems something bloats the memory and may affect the ALTER TABLE DROP COLUMN command. I am testing with the _ character now. This takes a while before I get a result. Once I get it, I will let you know. Otherwise, we will go with the pause approach.
>Also, could it be a problem with case-sensitive collation of the Server? In that case all field names should match exactly how they are defined in the database.
It is non case sensitive. Also, all that is generated from the data dictionary of my framework which reads everything from the Field table, which was the original source of the field creation. So, what you see is exactly the proper casing.