This question already has an answer here:
The wall of ice spell creates a destructible wall, with each 10-foot section having 30 hit points:
The wall is an object that can be damaged and thus breached. It has AC 12 and 30 hit points per 10-foot section, and it is vulnerable to fire damage. Reducing a 10-foot section of wall to 0 hit points destroys it and leaves behind a sheet of frigid air in the space the wall occupied.
Suppose a fireball spell detonates on the opposite side of the wall from me, such that the wall provides total cover against it. However, the fireball deals 27 fire damage, which is enough to destroy any sections of the wall caught in the blast (since the wall is vulnerable to fire damage). So, the fireball will definitely destroy my cover. So before the fireball, I definitely have cover, while afterward I definitely don't have cover any more. However, it's not clear whether I still have full cover against the effect of the fireball itself.
More generally, in any case where I have cover against an effect but the effect itself destroys that cover, do I gain the benefit of that cover before it is destroyed, or does the cover get destroyed before I can benefit from it?