dnd 5th – Does Detect Magic detect external divination spells?

Suppose a NPC caster uses a divination spell on the party to spy on or locate them, for example: Locate the creature or Clairvoyance or (in particular) the Scrying spell.

Would a player who launches Detect Magic make him aware of the spell and the caster?

And in the future, could he use Dispel Magic to end the effect, if it is detected?