I had a call today with a client that has over 120 GP company databases. Because there are so many databases, and so much data, they don't maintain all of the databases in their multiple test environments.
In the test environment we were working in, there were 22 company databases setup, but naturally GP still thinks there are 120, and displays them all in the company listing during login. Normally that wouldn't be an issue, but we were working with a 3rd party product that scanned all databases, and if a database wasn't present, an error would occur.
So this scenario is essentially the same as if a GP company database had been deleted through SQL Server Management Studio, instead of through GP. The records for the company database exist in the GP tables, but the corresponding master..sysdatabases records and physical databases "no longer" exist.
The KB article is titled "Deleting a company in Microsoft Dynamics GP", and is supposedly KB Article 855361. At least that's what it says on the version I found--there might be more than one version, as the client had the same script, but with a different KB number in his notes.
After more searching, I found this article on Customer Source, and this apparently identical article on PartnerSource that appears to reference the same script. But I can't find a KB Article number. Here is a File Exchange link to download the SQL script referenced in these two articles.
Despite my repeated attempts to search for 855361, KB855361, and even "Deleting a company", I couldn't seem to find the article through the PartnerSource search. Fortunately a Google search turned up a link to the article, and I was able to access it directly via the URL linked above.