Usually, the DM will know the level of the spells affecting the target. If it’s necessary for the caster to make an informed decision about using Dispel Magic, the DM might allow a Knowledge (Arcana) check to identify the spell level.