I plan to rent a car using my Friend's employee code. My credit card covers CDW( Collision Damage Waiver) and I think that's what the company covers too. So will my credit card cover the insurance just in case anything happens? Will it be a problem if I use my friend's code?
If you don't need the insurance, it is likely that no-one will care. However, my experience with company discount codes is that rental locations may ask for employee card or any other evidence of you actually being entitled to use the discount. I once had to allow the rental desk email me at my work email address to confirm.
If something does happen and you actually need that insurance - then you'll be in a lot of trouble. Your credit card will refuse to cover since your rental agreement would show CDW being included. But the rental company at that point will most definitely check if you were in fact entitled to use the discount, and will refuse to honor the contract CDW since you were not entitled to use the discount. As mentioned, your friend will get in trouble as well for sharing the code, and the company may get in trouble with the rental company for allowing this to happen.