try:
exec master..xp_cmdshell 'bcp 
"select '表头1','表头2','表头3',.... union
select 字段1,字段2,字段3,......." 
queryout 路径\文件名.xls -c -q -S服务器名 -U用户名 -P密码'