I've read many novels where the author has a character working for CBS...or NBC news anchor, or an editor at Vogue....they are fictional books but are we as writers allowed to do this? Can I say my character is the CEO for Walmart?
First, you probably want to consult a lawyer if you're really thinking about doing this, as the Internet is not the place to get legal advice to go by. So don't take anything as gospel.
That said.... in a general sense, you can mention companies, people and trademarked things (Bob chugged a Pepsi/Sue was a researcher for NBC/Timmy went to the Miley Cyrus concert) but when you do anything to drag those things into your fictional world and manipulate them in some way, you're on the verge of, if not running right into, trouble.
Miley Cyrus can't start talking in your novel, because real Miley Cyrus can sue you. Bob can't chug a Pepsi just before he cuts up each of his victims for that Pepsi feeling. Sue can't be a researcher for NBC who does X story, gets in X conflict at work, does Y unethical thing. I mean they *can* but it's the road to litigation city.
I don't really think I've read many novels in which people work for actual companies. Most people change the names to protect the guilty, for this exact reason. Though everyone knew Lauren Weisberger worked at Vogue, in the book, she worked at Runway, which does not exist.
Again all that said, changing names isn't a guaranteed protection either -- people can and do sue for anything, and people (or companies or whatever) can win those lawsuits if they're recognizable to a reasonable person. A big company will bury you in legal fees if they feel like it regardless.