Shortly after a woman opened fire at YouTube headquarters in California on Tuesday, executives at Dick’s Sporting Goods Inc. in suburban Pittsburgh logged on to their internal sales database, searching for the attacker’s name.

“Every time there’s a shooting, the first thing that we do is we go through all the records to find out who the shooter was, and did they buy the gun from us,” said Dick’s Chief Executive Edward Stack. “It really puts a pit in our stomach.”

The...