Query XML Extended Events Data?

but you dont know if that value is really source_database_id. It does not make it source_database_id just because you aliased it as source_database_id. There are other data points, object_id, object_type

How did it know "Statement" is the SQL statement that was run ?

because it is a wildcard search

Where Statement LIKE '%exec%'

If I had a query that included

Where Statement LIKE '%JOE%'

Would it include results where 'JOE' was in the SQL statement, and results if 'JOE' was in another field like Login_Name or Database_Name if those were part of the XML ?

yep it sure would, that is why the pivot options makes sure to identity the correct column to filter on and not any random data point.