
We can run SOQLs on Profile and PermissionSet to find specific Permission enabled in Salesforce Profiles and Permission Sets.
In the follow example, I am checking the permission “Author Apex”.
Profile Permission Check:
SELECT Id, Name
FROM Profile
WHERE PermissionsAuthorApex = true
Permission Set Check:
SELECT Id, Name, Label
FROM PermissionSet
WHERE PermissionsAuthorApex = true