The below stored procedure performs a RESTORE of the newest BAK file in the specified directory (@bkpDir). I recommend putting it into an Admin database (hey just name it Admin!) rather than in master.
------------------------------------------------------------------------------------------------------ OBJECT NAME : isp_Restore-- AUTHOR : Tara Duggan-- DATE : November 3, 2005-- INPUTS : @dbName - name to use for the restored database-- @bkpDir - full path to the directory where the BAK files exist-- @newDataLocation - new location and file name for the MDF, can be NULL-- @newLogLocation - new location and file name for the LDF, can be NULL-- OUTPUTS : None-- RETURN CODES ...