You can get the server name from SQL with this:
SELECT @@SERVERNAME AS 'Server Name'
to rename:
SP_DROPSERVER 'OLD_SERVER' sp_addserver 'NEW_NAME' , local *then restart SQL service
This may be useful if you have renamed your server, but the database doesn’t reflect the change. OR you have changed servers and a program require the original SERVERNAME.