Solution 1:

Follow these steps to add an alias:

  1. Open SQL Server Configuration Manager
  2. Expand SQL Native Client Configuration
  3. Right-click Aliases and select New Alias...
  4. On the New Alias window:
    • Enter .\SQLEXPRESS for the Alias Name.
    • Select the appropriate protocol (e.g., Named Pipes)
    • Enter . for the server name (that's equivalent to localhost).
  5. Click on OK to make the change.

Changing the HOSTS file to include a setting for SQLEXPRESS will only redirect DNS lookups for a machine called SQLEXPRESS to the specified IP address. That will not cause .\SQLEXPRESS to resolve to the localhost SQL instance.