If you are going to write, you must be able to read analytically.
That means as a mechanic. You need to read the scene without getting immersed in it; you want to remain analytic and understand the machinery that is creating the effect that you like.
You need to figure out what it is about your "good" scenes that makes them good. Is it the pacing? Word choices? Character emotions? Conflicting desires of characters?
What is in, and what is out? Do your sentence lengths reflect the mood of the piece? Are you using brighter adjectives, or are the characters being more clever, or funny?
Do your sentence lengths vary? Is it in the dialogue? Is it in the description details -- Are they sparse and on point? Do they reflect the mood of the scene?
Is it just the setting that makes it easier to describe? Would your dull scene be improved by getting the job done in a different setting? More dangerous, or more active, or more quiet? Should this be set in a hospital, or stranded on a road, or in a city park?
Analytic reading is good to perform on expert writing, but especially your own writing that you like. You need to find what is your style.
You say the flat scenes are needed parts of the plot.
If your scene is flat, that generally means it is doing only one job, imparting information, or perhaps informing the reader of a character decision. That is like just eating mayonnaise for the calories.
Your scene needs to be doing multiple jobs; at minimum some emotional work while imparting new information.
So you can invent some emotional work to do, or move the information development into an earlier or later scene. Or make the information development traumatic, or unexpected, or costly to one of the characters, that was counting on something else.
If you cannot do that, make the scene as short as you possibly can. Sometimes condensing a scene makes it better.