Here is part of a script that I wrote that moves files from one server to another using sql.
EXEC master..xp_cmdshell 'net use T: \memdsa1\staging_area @pwd /user:@domainuser/persistent:no'
EXEC master..xp_cmdshell 'net use S: \memdev01\stagingarchive @pwd /user:@domainuser/persistent:no'
I want to know a way that you can package this into a stored proc and pass the @pwd variable my password and @domainuser variable my domain\user.
Right now, I am hardcoding it running the script and then changing it back.