If a spell has multiple rays or beams or whatever, then you can target the first beam, roll, and observe the effects before nominating the second target.
Magic missile is an exception. You must designate all targets at the same time, then all the missiles hit simultaneously.
If someone successfully counterspells you in the middle of such a casting then the damage you did with rays that have already hit is rolled back.
If you want to roll once for magic missile (or scorching ray or whatever) and have the roll apply to every missile then that is fine. If you want to roll separately, that is fine too (some players like to roll lots of dice). You must decide before you roll any damage dice.