One must always preface an answer to this sort of question by the reminder that the West is the largest region of North America, composed of extremely diverse places. In addition, the history that might describe the "Old West" includes roughly a half century during which there was considerable change. Generalizations about cultural practices must include more exception than generalization, so it is realistically not possible to answer this sort of question easily, and there are no simple answers.
That said ...
The nineteenth-century West could be a relatively generous place for African Americans. At least some of the '49ers of the California Gold Rush regarded African Americans as good luck, so at least one of them were often welcome in a camp. During the Civil War, the West tended to stand with the Union, and there could by sympathy for the plight of the slave, so there were often generous attitudes to African Americans.
What generosity that did exist was encouraged by the fact that in the nineteenth century African Americans were few in number in the West, and they were not, consequently, challenging access to employment for whites. This same sort of generosity was NOT extended to Native Americans or to Asians, for example, both of whom would have typically received much harsher treatment when entering a white-owned business.
Evidence of what an African American entering a saloon could expect is scattered and rare, so it is difficult to generalize. There was no regionwide "code" about how to treat such a situation. One might be able to find clear evidence of this sort of thing in the South, but not in the expansive West. There were no set rules, in general.
I balk at the term "black cowboy." There were, of course, African Americans who worked on ranches, but the West was highly urbanized - more than other regions - so most people and most African Americans lived in towns/cities. And of course, the saloon would be in town, whether an African American came from a ranch or from within the community. I will discuss this question in general rather than specifically for ranch hands - because that is what I assume you are after.
Accounts of African Americans going to a saloon are extremely rare, which suggests that boundaries were not often tested, or people did not think much of such an occurrence. There are photographs of groups of men outside saloons (interior photography was relatively rare for much of the nineteenth century). Sometimes these include an African American. Was this a patron or someone who worked in the saloon? We don't know, but either way, these saloon patrons would apparently see an African American within, so there was that degree of integration.
There is this interesting image from Virginia City, Nevada in the early 1860s. It appears to depict an African American (back row left of center) witnessing a hurdy gurdy show at a saloon. This may be an artistic representation of integration, or it may be a glitch in printing!
There are also records of African Americans operating saloons. I worked with archaeologists in the excavation of the Boston Saloon (1863-1875) in Virginia City. It was owned by a freeborn African American, William A. G. Brown, and it served the African American community. This should be regarded as a saloon fitting a specialized market rather than as an indication that African Americans could not drink elsewhere. There were Irish, French, German, and other saloons, but people of those places of origin were free to patronize other saloons. On the other hand, a Cornish miner would be a fool to go into an Irish Saloon - and so, perhaps, would an African American. One needed to have situational awareness to survive when navigating the saloons of a diverse Western community!
The Boston Saloon was integrated: an article in 1866 describes the only white man in the saloon, a patron named "Frenchy," who was playing poker with other men. He had a pistol on his lap, and when it fell to the floor, it discharged and shot Frenchy in the leg. So ended the integration for the day! But the account does give us some insight. Clearly, here was a place where the African American, whether coming from the ranch or down the street could buy a drink and find a community of peers. Such situations were easy to imagine in other communities of size.
We found a pipe stem at the Boston Saloon, and in one of the first attempts to retrieve DNA from non-human remains in a nineteenth-century archaeological site, we had some success. We were hoping to identify the ethnicity of the person who smoked the pipe and left a dent in the stem where tooth rested comfortably, but ethnicity was inconclusive. It was, however, apparent that the person who smoked the pipe was a woman!
For smaller towns with one or only a few saloons, the situation would likely be free-form. Our African American entering a saloon alone might not be well received. Testing the limits by entering the place would probably be ill-advised without knowing the range of possibilities beforehand. Going to such a place with a group of white patrons would increase the likelihood of being well-received, I imagine - but I can only imagine. Again, sources are not abundant on this point, or at least I have not read anything that addresses this!
One other point to make, is that many saloons also sold bottles of wines and liquors and buckets of beer off premise. It was not uncommon for patrons to come into a saloon to buy products as one would visit a liquor store today. In most cases, I can't imagine a great deal of opposition for an African American wanting to spend money in this way. And again, conducting a mind experiment where we substitute a Native American or a Chinese emigrant in this situation, and the result would conjure a more hostile reception, so we can imagine the African American receiving more generous treatment.
All this said, one would not want to characterize the West as some sort of paradise for African Americans. Oregon did have a law against having African Americans in the territory, but that was more for show than something that was realistically enforced, and that was the exception. Throughout the region, African Americans could expect to face racism and state and local laws and ordinances that made it difficult to navigate throughout one's life, but in general, treatment was better than in many places in the US.