Execute Mysql queries using the same file more than once
The problem is, you should not be trying to create an ever-growing set of queries in this manner. 

Of course the first step in your example fails on the second run, since the imageFormat column has already been dropped.  There is nothing to restore imageFormatand there is no error handling to cope with the missing column.

I cannot fathom why you would want to build up your queries in such a manner. 

If your goal is to record every query that you run, then insert the code into a table that records the time and the code that you run. 

But do not expect to run all the commands without errors unless you have scripted the code to also deal with each exception that may arise.