Replication error after server name change
sp_dropserver 'real-server-name' was giving an error about remote logins:


  There are still remote logins or linked logins for the server ...


Therefore, I executed the following query:

execute sp_dropremotelogin old_physical_server_name;


...but this gave the following error because of replication:


  There is no remote user '(null)' mapped to local user '(null)' from the remote server ...


Then I executed:

execute sp_removedbreplication 'database-name-on-which-publication-exist';
execute sp_dropdistributiondb 'distribution-database-name';


...still the same error. Finally I tried:

execute sp_dropdistributor @no_checks = 1, @ignore_distributor = 1;
execute sp_dropserver 'real-server-name';
execute sp_addserver 'nwe-server', 'local';


This resolved the issue.