I need to get a list of System databases from SQL Server.
A bit of googling provided enabled me to develop this SQL statement:
owner_sid is equal to 0x01 just for system databases. So you can use it to recognise if the database is a system DB or not.
select * from sys.databases where owner_sid != 0x01
This works, it gives me a list of system databases.