Not sure if there is a simpler way, but I found a fairly straightforward way that works against a couple SQL Server instances that I tested.
import arcpy
import os
inst = # SQL Server instance
sql = ("SELECT name "
"FROM sys.databases "
"WHERE CASE "
"WHEN state_desc = 'ONLINE' THEN "
"OBJECT_ID(QUOTENAME(name) + '..[SDE_Version]', 'U') "
"END IS NOT NULL")
conn_path = # Output folder for database connection file
conn_name = # Output name of database connection file, including .sde extension
conn_file = os.path.join(conn_path, conn_name)
arcpy.CreateDatabaseConnection_management(conn_path,
conn_name,
"SQL_SERVER",
inst,
"OPERATING_SYSTEM_AUTH")
sde_conn = arcpy.ArcSDESQLExecute(conn_file)
sde_res = sde_conn.execute(sql)
print sde_res
The code above looks for a specific SDE system table to determine whether a SQL Server database is a geodatabase. I don't know whether I picked the best system table, maybe there is a reason the one I picked isn't a good idea, I don't know.
The code should print a list of geodatabases within a SQL Server instance (note, if no geodatabases are found, a Boolean True will be returned instead of an empty list or string). Once you have the list, you can create a database connection file for each geodatabase and do whatever other work you planned.
The SQL code was adapted from Display all the names of databases containing particular table.
UPDATE: Code updated to address offline databases, thanks Rebecca Strauch, GISP for pointing out the problem with offline databases.