Prueba asi:
Código sql:
Ver originalDECLARE @FileName VARCHAR(50),
@bcpCommand VARCHAR(2000)
SET @FileName = 'c:\PRUEBA_' + CONVERT(CHAR(8),GETDATE(),10) + '.txt'
SET @bcpCommand = 'bcp "SELECT * FROM db.dbo.TB" queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -c -T -S servidor\instancia -U usuario -P pass '
EXEC master.dbo.xp_cmdshell @bcpCommand