On top of all the wars and global messiness, 2014 will be remembered for the plague of “corporate inversion,” which the news media should start routinely calling “corporate desertion.” So far, 47 American-based companies have renounced U.S. citizenship and bought foreign subsidiaries in order to dodge American taxes. Many more are preparing to flee.

This past month , Heather Bresch, the CEO of Mylan, a Pittsburgh-based generic drugmaker, announced that the company is, on paper, becoming Dutch. Mylan is now just another unpatriotic firm like Walgreens, Medtronic or Chiquita, but with a difference: Bresch’s father happens to be Sen. Joe Manchin, a West Virginia Democrat. Manchin claimed implausibly that he knew nothing in advance. When pressed, he announced that he backs legislation making his daughter’s decision illegal.

That bill, sponsored by Sen. Carl Levin in the Senate and by his brother, Rep. Sander Levin, in the House, recently won the backing of President Obama, who made a good speech in Los Angeles blasting these companies as “corporate deserters.” Of course, the president’s support means that all Republicans must now oppose it.

So the bill is going nowhere. When angry constituents ask why, legislators answer that ending corporate desertion should be subsumed under comprehensive tax reform. But that’s a mirage. Waiting for tax reform is like waiting for Godot—no one shows up. Look what happened early this year when Rep. Dave Camp, chairman of the once-powerful House Ways and Means Committee, slaved over a big tax bill that was a decent starting point for bipartisan talks. He was laughed out of town by fellow House Republicans (literally, he’s retiring).

Most members of Congress favor a lower corporate tax to make American business more competitive abroad. And they’re right: a 35 percent tax rate is too high. But their wealthy campaign contributors—trying to have both cake and candy—reject closing the loopholes necessary to keep a big corporate tax cut from wrecking the Treasury. In the meantime, as Allan Sloan notes in Fortune, companies that think they could be losers under tax reform are rushing to desert.

Even if comprehensive tax reform miraculously passes, it wouldn’t reduce the corporate tax rate enough to stop the desertions. That’s because other countries have slashed their corporate taxes or eliminated them altogether.

So it’s time for red-blooded Americans to take matters into our own hands. My answer is to make every corporation sign something.

Sign what? If Republicans cared about this issue, which most don’t, they would revive McCarthy-era loyalty oaths, where people were forced to swear that they weren’t communists.

Remembering those dark days, Democrats don’t like oaths, or even pledges, which have proven enormously effective. Grover Norquist’s ability to get nearly every Republican in Congress to sign a no-new-taxes pledge is one of the most successful political gambits of recent decades—and a big reason for today’s gridlock.

Because oaths and pledges are a little creepy, this effort needs something else—something that comes out of the legal and business worlds: a contract. More specifically, an NDA.

Non-disclosure agreements are common in corporate America, where tens of thousands of senior managers and employees sign contracts promising to keep all sorts of information confidential. It’s often a condition of employment.

Now it’s time to change the “D” and expect the same from boards of directors—a “non-desertion agreement” with the John Hancock of every board member and CEO in the United States.

If boards thought for even a second about the long-term interests of their companies, they would summon their lawyers and sign. It’s protection against the risks of resurgent nationalism that could strip them of the many advantages (indirect government subsidies, easy access to American markets) that they currently enjoy.

For those companies less able to act as Americans or recognize their real interests, there are two ways to make this work. The president should issue an executive order that says any company that wants to keep its federal contracts must sign a new-fangled NDA. It’s reasonable to expect most federal contractors to be American companies. Obama has already used that leverage to raise the minimum wage for companies doing business with the government and, in a little-noticed move, to force government contractors to pay their suppliers on time.

This executive order would get the attention of major corporations, most of which receive federal contracts. Mylan and Medtronics, for instance, are deserting even as they receive hundreds of millions of dollars in taxpayer money through Medicare and Medicaid. But other companies with few or no federal contracts might be tempted to desert anyway.

That’s where the rest of us come in. Under my scheme, companies that sign non-desertion agreements would embed a tiny American flag or some other Good Housekeeping-type seal in their corporate insignia for all to see, just as companies during the Great Depression that agreed to Franklin Roosevelt’s recovery plan hung an emblem of a blue eagle in their windows with the legend, “We Do Our Part.”

Companies that fail to sign non-desertion agreements would face the kind of public shaming that has gone out of fashion but could come back with a vengeance: boycotts, petitions, angry shareholder meetings full of the language of patriotism.

At first glance, this kind of shareholder and customer uprising sounds unlikely. Opponents of Walgreens’ move to Switzerland haven’t yet found much traction. These days, an “activist investor” is usually someone on the other side of the issue claiming that companies have a “fiduciary responsibility” to desert the U.S. if it means lower taxes and thus higher shareholder return. Even Mr. 9/11, Rudy Giuliani, now a corporate front man, made that point on CNBC. Many of the same conservatives who believe, along with the Supreme Court, that corporations are people, apparently don’t think that companies have any of the obligations of citizenship.

Fortunately, these un-American arguments are destined to fail with the American public as the issue ripens. That’s because efforts to stop desertion aren’t populist or socialist but nationalist, a much more powerful force in American politics. Unbridled nationalism is a menace; it leads to trade wars and, all too often, real wars. But properly channeled, nationalism and patriotism are matters of the heart that cut to our deepest ideas of who we are.

With viral online organizing, the idea of non-desertion agreements could spread quickly. Then American corporations will learn that if they want to enjoy this country’s bounty, they’ll have to be good citizens and pay taxes like the rest of us.