Usually, no, you cannot know, and the company would not know, either. A denarius is a denarius like all its fellows.
If you’re asking if it is a sin, I do not think it is so, any more than you buying from someone who then uses the money to cheat on his wife. Unless you bought the object with the express intention of supporting a particular sin, of course, such as adultery or murder.
You can’t be sure and buying something from the company is not a sin (directly or indirectly).
If everyone had to avoid buying anything from companies/stores etc that have policies contrary to Church teachings we would all be naked, hungry, thirsty and homeless.
We have to have common sense about this.
Let’s say Bob’s Pizza supports abortion by giving money to planned parenthood, and you buy $20 worth of pizza from Bob’s, you are still supporting abortion. Just because your specific $20 might go to paying a salary, buying advertising, or buying flour to make dough, but it still frees up $20 in the company, which it can then send to planned parenthood. Basically, by buying from Bob’s Pizza, you’re helping to keep them in business, which helps planned parenthood continue to kill children.
Everything being equal yes, but in business it is not always guaranteed that one will have enough money to support one’s pet causes. So again, the same problem occurs, for unless we know how much money a co. will make in the future and what they plan to spend it on, we cannot know that our $20 will in this case necessarily go to supporting anything.
Plus, that freed $20 does not need to be worth anything regarding abortion; perhaps the minimum donation is $100.
So let’s take this a step further: suppose it’s Bob, and not Bob’s Pizza, supporting PP. One could argue that in buying pizza, one is contributing to Bob’s personal income, from which he makes contributions to PP. Granted that in the case of a one-owner business, the difference between the business and personal income might be difficult to determine, so in this case it might be a distinction without a difference. But let’s take your example to a larger business: do we not support businesses if we know their employees - and not the business - support immoral causes from their personal income – which our purchases enable by keeping the firm in business? We may not be responsible for an employee’s personal decision, but if we support a business that provides salaries to people who use their money to support such causes?