No. If we assume that you have to target the wall it would at the very least stop after destroying the wall.
But by RAW, you can’t even cast it on something behind the wall, because you cannot target something (or someone) with a spell if they are behind total cover. Total cover is created by being completely behind an obstacle (like a wall). This counts even if the obstacle is invisible.
Furthermore, if you chose an invalid target for a spell, you still expend the spellslot but there will be no effect. So you'd actually spend a sixth level spell a lot to achieve nothing.
I would not recommend doing it this way, but that’s what the rules say.