The value of X is locked in after you choose targets but before you pay costs for Urgent Necropsy. In the extremely unusual case where the mana value of one or more of the targets changes while you're paying costs, the cost to cast Urgent Necropsy, including the additional cost, remains what you previously determined.