Chances are you are creating a file and supplying only the filename, like
StreamWriter writer = new StreamWriter("myfile.sql")
When you do that the file gets put in the same folder as the executing process, so that will be the debug folder. To avoid this and put it somewhere else you need to give the full path to where you want it to go;
StreamWriter writer = new StreamWriter("c:\myfiles\myfile.sql")