Indicates if a proposed instance name has been used for an instance of Microsoft® SQL Server™ already installed on the computer.
BOOL IsInstanceNameValid ( LPTSTR lpszInstanceName );
Is a pointer to a character string containing an instance name. For more information about the correct format of an instance name, see Instance Name.
TRUE if the instance name has not been used by any of the instances of SQL Server installed on the computer. FALSE if the instance name has already been used.
IsInstanceNameValid cannot be used to check whether a default instance has already been installed. The Desktop Engine Setup will return ERROR_DUP_INSTANCE_NAME if you attempt to install a default instance when one has already been installed on the computer.