Sir Walter Scott didn’t come out publicly as the author of his enormously successful novels until 1827. What finally drove him out into the open was not excitement or pride but, sadly, financial embarrassment. Scott had made a ton of money as a writer since he published Waverley in 1814, but he lost it all in one bad year, during the financial crisis of 1825-26. The public soon found out where Scott’s now-lost money came from: profits from a lifetime’s work of writing (source).
Scott’s financial embarrassment wasn’t even his fault: he had agreed to be a co-signer for loans for a friend, James Ballantyne, when his publishing house ran into money troubles. When Ballantyne’s publishing house went belly-up, he left Scott on the hook for all of his debts. So the debts weren’t even Scott's in the first place (source).
One reason Scott may not have wanted people to know that he was a novelist is that novels were still seen as mainly a low-class form of entertainment in the early 19th century. Scott’s day job was as clerk to the Court of Session in Edinburgh. He also eventually became a magistrate (a kind of judge), and the British Crown declared him a baronet (normally a hereditary title) in 1820. All this came about while he was secretly writing 400-page novels. We have to admit we’re impressed: we’ve never managed to write a 400-page novel, and we’re not juggling promising legal careers at the same time. Scott was a guy who knew how to multitask! (source)