Prepared exam essay matches published example
I assume from your question that he didn't only see the published essay but also read it. Then it will be nearly impossible to write his own essay, because he will always (even if unintentionally) adjust his work to not look like plagiarism. That will, of course, only strengthen the impression that he is plagiarizing.
Thus, I would take what he has up to now, the prepared essay that he wrote before finding the published one online, not change it in any way (even if the urge to avoid plagiarism might be strong) and talk to the one responsible about it right now; showing the current essay to try to prove his story.
What happens then depends on the regulations in that class. But there should be a possibility to rewrite the exam, e.g. for sick students or for students that failed the first try; maybe he can get in there with a new topic.
I would not try to get a new topic done today, that would only result in a really bad grade.