Note to myself.... Sometimes for development and testing purposes there is a need to add linked server using SQL Server that will actually point to itself so queries work properly with linked server name.
Below is the statement that I always forget:
How to use?
Open a query in SSMS, paste the code from above and change:
1) For @Server provide a friendly name of the linked server. This name will appear in Linked Server folder (nothing to do with a server you are connecting to)
2) @srvproduct - not what what the easy, so I go with empty string ''
3) @provide - leave as it is if you are connected to SQL Server or update to your preferred one.
4) @datasrc - This is the server location.
For move info visit Microsoft sp_addlinkedserver