• set @FileNameOut ='OutputConsistencia_'+@db

    select @cmd = 'osql -U'+@user+' -P'+@pass+' -S -Q"dbcc checkdb ('''+@db+''') with no_infomsgs" -o"c:\'+@FileNameOut+'.txt" -w500'

    create table #t (cmdout nvarchar(255), id int identity)

    Insert #t Exec master..xp_cmdshell @cmd

    Select * from #t

    This way does not rely on setting up linked servers or Openquery being allowed at all.

    (of course if xp_cmdshell is allowed then probably everything else is too)