Here is one solution:
--Create a work table
CREATE TABLE Temp (Col1 varchar(200), Col2 varchar(200))
INSERT INTO Temp
(
Col1,
Col2
)
SELECT Col1, Col2 /*Your main query goes here*/
FROM MyTable
--BCP out the query result saved in Work table
EXEC Master..XP_CmdShell 'bcp "DBName.[Owner].[Temp]" out "c:\MyFile.txt" -c -U UserName -P Password'
--Cleanup
DROP TABLE Temp
After "out" in BCP command you can specify the output location.