MS SQL doesn't provide functionality to set this parameter through API.
You can use Client Network Utility (included into MS SQL Server package), or make corresponding changes in the registry directly (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo)