Bank investors are in a bit of a conundrum. While many banks look cheap on a valuation basis and the industry's results have held up relatively well as economic growth slowed, the concern remains that if the U.S. enters a recession, the group's earnings will decline and their shares could fall further. That's why investors are asking which banking segment will fare the best in a possible recession, Piper Sandler analysts led by Mark Fitzgibbon wrote in a Wednesday note titled "Where to Hide if Bank Stocks Continue to Slide." The analysts examined the last two downturns: the 2008 financial crisis and the early 2020 coronavirus selloff. In both cases, smaller banks performed better than the megabanks, Fitzgibbon wrote. That continues to be true during this year's retrenchment, he noted. The largest banks have lost 15%, while institutions with less than $10 billion in assets were down 6%. "While the correlation is not perfect, generally the smaller banks have outperformed the larger banks," the analysts wrote. "We believe this trend will continue if banks stocks remain under pressure… we would advocate owning smaller banks as opposed to larger banks." That's because "in periods of distress, investors will sell larger banks to a greater degree" because their shares are more liquid, or meaning easier to sell at accurate prices. Furthermore, smaller banks tend to have higher capital levels and more transparent balance sheets than large banks, the Piper Sandler analysts wrote. Big banks like JPMorgan Chase and Bank of America have large Wall Street operations that are more opaque and can be exposed to market volatility. The analysts screened their coverage universe and found 21 banks with a market cap below $1 billion that were overweight rated and whose price targets implied upside of at least 20%. The upshot: If the economy improves, these banks are poised to benefit; if it turns south, their stocks are likely to fare relatively better than others. Here are four of their top picks: Farmers National Bank Canfield, Ohio-based Farmers has assets of $4.1 billion and 41% upside if its price target is met. Meridian Bank The Malvern, Pennsylvania-based bank with branches in four states could see a 40% stock appreciation. Old Second Bank Shares of the Aurora, Illinois-based community bank with $6 billion in assets could rise 36%. FinWise Bank The 22-year-old "financial tech bank with a community heart" based in Sandy, Utah has 34% stock upside if the Piper Sandler price target is met. —CNBC's Michael Bloom contributed to this report.