I think this is a task better suited for Version Control System, such as git.

  1. Export all relevant code from the first namespace
  2. Commit
  3. Export all relevant code from the second namespace 
  4. Diff

And for CD/CI systems such as Jenkins, GitHub or GitLab.

That said you can use this SQL to compare class hashes (if hashes are identical than classes are identical)

SELECT
  Name,
  Hash,
  TimeChanged,
  TimeCreated
FROM %Dictionary.CompiledClass

After that you can use this SQL to compare hashes of the individual methods (if classes do not match):

SELECT
  parent,
  Name,
  RuntimeHash
FROM %Dictionary.CompiledMethod