I try to learn the exact bass line as an ear-training exercise. After that, I go with whatever works with what my bandmates are doing, and sometimes I'll adjust it to my own preference.
I have one bandleader who says "those songs sold millions of copies for a reason" to justify replicating the songs as closely as possible. For that band I try not to deviate too much.
In his defense, some musicians deviate out of laziness: they skip complicated parts, they insert their own frequently-played licks rather than something that would better fit the song. That said I think a bigger factor is that he's a bit of a control freak.
I have the most fun when deviating in a planned, creative way. Just one example: a BL I worked with put a funky New Orleans beat to the well-worn standard "Honky Tonk Women" and made it a lot more fun to play.