Batch file scripting for stored procedures backup
===

I am creating one batch file which will do the below operations in order. This is specially for SQL scripts execution in database.

1. Run all the .sql scripts in the current direcoty where its been placed
2. Take the backup scripts for each stored procedures and funtion in the current folder before running and place it in specific folder
3. Run the latest version of scripts in the directory 
4. Log if there are any error messages 

I have almost covered the part of this implementation but for couple of things. 

1. I am using %%f loop to loop through the .sql file in the current folder - the backed up script is not placing inside the specified directory. - If I provide update number 10 - it should create a folder as 10 and should place all the backed up scripts in side it.

2. and if i run the same batch file from the folder 10 - as this folder already have backed up scripts it should npt take the back up again. I am providing here the script details. Some body pls help me to achieve this. 

