Given the text: Recently I was asked for a DOS batch script, that a tech person could run, to give a stand-alone instance of SQL Server the new hostname of its server. This batch file would be run once the server name was changed.
This batch file removed the old hostname from SQL Server, and pulled the new computer name from the operating system’s environmental variables. Then it stops & restarts SQL Server service. The net start & net stop should reflect the current name of the SQL Server service, and may need to also restart the SQL Agent service.
Note: Normally I am asked to do this in PowerShell, but these are older servers that do not have PoweShell installed. Therefore the script had to be done as a DOS batch script. The script assumes local administrator privileges & that sqlcmd is in the executable search path.
sqlcmd -E -Q "select @@servername as 'Old Hostname';"
sqlcmd -E -Q "exec sp_dropserver @@servername"
sqlcmd -E -v new=%newcomputername %  -Q "exec sp_addserver  '$(new)','local'"
sqlcmd -E -Q "select @@servername;"
How does the batch script mentioned in the given text remove the old hostname from SQL Server?
This prompt doesn't seem malicious.