It's not the code. I have run into this problem a few times when I copy code from this site. I seems that some Unicode characters get inserted in the code. If you try to save script from the query window in Management Studio I get a warning "Some Unicode characters in this file could not be saved in the current codepage."
It seems that what LOOK like blank spaces are actually some unprintable character. If you delete the spaces on the lne indicated in the error and try it again you will get the same error but on a different line.
Very frustating. What I end up doing is to highlight JUST ONE of the "blank" spaces and run Find and Replace with a real blank space. There is probably a better way.